import { S } from '../../s';
import { IPSAppView } from './ipsapp-view';
import { IPSAppViewRef } from './ipsapp-view-ref';
import { IPSNavigateContext } from '../../control/ipsnavigate-context';
import { IPSNavigateParam } from '../../control/ipsnavigate-param';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppViewRefImpl
  extends PSModelObjectImpl
  implements IPSAppViewRef
{
  get height(): number {
    return this.M.height != null ? this.M.height : 0;
  }

  get name(): string {
    return this.M.name;
  }

  get openMode(): string {
    return this.M.openMode;
  }

  get owner(): IModel {
    return this.M.owner;
  }

  protected psnavigatecontexts: IPSNavigateContext[];
  getPSNavigateContexts(): IPSNavigateContext[] | null {
    return (
      this.psnavigatecontexts ||
      (this.psnavigatecontexts = this.fillChildListModel(
        this.M.getPSNavigateContexts,
        S._8c,
      ) as IPSNavigateContext[])
    );
  }

  findPSNavigateContext(objKey: any): IPSNavigateContext | null {
    return this.getPSModel5(
      S._8c,
      this.getPSNavigateContexts(),
      objKey,
    ) as IPSNavigateContext;
  }

  protected psnavigateparams: IPSNavigateParam[];
  getPSNavigateParams(): IPSNavigateParam[] | null {
    return (
      this.psnavigateparams ||
      (this.psnavigateparams = this.fillChildListModel(
        this.M.getPSNavigateParams,
        S._8a,
      ) as IPSNavigateParam[])
    );
  }

  findPSNavigateParam(objKey: any): IPSNavigateParam | null {
    return this.getPSModel5(
      S._8a,
      this.getPSNavigateParams(),
      objKey,
    ) as IPSNavigateParam;
  }

  get parentDataJO(): IModel {
    return this.M.parentDataJO;
  }

  get realOpenMode(): string {
    return this.M.realOpenMode;
  }

  get realTitle(): string {
    return this.M.realTitle;
  }

  protected realtitlepslanguageres: IPSLanguageRes;
  getRealTitlePSLanguageRes(): IPSLanguageRes | null {
    return (
      this.realtitlepslanguageres ||
      (this.realtitlepslanguageres = this.fillObjectModel(
        S._276,
        this.M.getRealTitlePSLanguageRes,
        S._2dd,
      ) as IPSLanguageRes)
    );
  }

  protected refpsappview: IPSAppView;
  getRefPSAppView(): IPSAppView | null {
    return (
      this.refpsappview ||
      (this.refpsappview = this.fillObjectModel(
        S._1e,
        this.M.getRefPSAppView,
        S._2af,
      ) as IPSAppView)
    );
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get viewParamJO(): IModel {
    return this.M.viewParamJO;
  }

  get width(): number {
    return this.M.width != null ? this.M.width : 0;
  }
  get cls(): string {
    return 'PSAppViewRefImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._8d || cls == S._7) return true;
    return super.instanceof(cls);
  }
}
